1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4
5 public
class CircleMovement : Movement, IPieceMovement {
6
7     
public CircleMovement(GCPlayer player, Piece piece) : base(player,piece) {
8         BoundComputations += ComputeBound;
9     }
10
11     
public override void ComputeBound() {
12         Node currNode = piece.Node;
13         
int origRow = currNode.row;
14         
int origCol = currNode.col;
15         
16         Node frontNode =
null;
17         Node leftEatNode =
null;
18         Node rightEatNode =
null;
19
20         Grid grid = GameManager.Instance.Grid;
21         GCPlayer p1 = p1 = GameManager.Instance.P1;
22
23         
int toAdd = 0;
24         
if (p1.Has(piece)) {
25             toAdd =
1;
26         }
else {
27             toAdd = -
1;
28         }
29
30         frontNode = grid.GetNodeAt(origRow + toAdd, origCol);
31         leftEatNode = grid.GetNodeAt(origRow + toAdd, origCol -
1);
32         rightEatNode = grid.GetNodeAt(origRow + toAdd, origCol +
1);
33
34         ComputeMoveOrEatPiece(leftEatNode);
35         ComputeMoveOrEatPiece(rightEatNode);
36         ComputeMoveOrEatPiece(frontNode);
37     }
38 }


Gõ tìm kiếm nhanh...